<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{.CurrentNotice.Title}} - AI Collections</title>
    <link rel="stylesheet" href="/ai-collections/static/css/style.css">
    <link rel="icon" type="image/png" href="/ai-collections/static/images/logo.png">
    <meta name="version" content="20250502-simplified">
    <style>
        .notice-container {
            max-width: 800px;
            margin: 0 auto;
            padding: 2rem;
        }

        .notice-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .btn-back {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            text-decoration: none;
            color: var(--text-color);
            font-weight: 500;
        }

        .btn-back:hover {
            color: var(--primary-color);
        }

        .notice-detail {
            background-color: var(--card-background);
            border-radius: 1rem;
            overflow: hidden;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }

        .notice-header {
            padding: 2rem;
            border-bottom: 1px solid var(--border-color);
        }

        .notice-title {
            font-size: 1.75rem;
            font-weight: 600;
            margin-bottom: 1rem;
            color: var(--text-color);
        }

        .notice-meta {
            display: flex;
            justify-content: space-between;
            font-size: 0.875rem;
            color: var(--text-light);
        }

        .notice-content {
            padding: 2rem;
            line-height: 1.8;
            color: var(--text-color);
            white-space: pre-wrap;
            min-height: 200px;
        }

        .notice-footer {
            padding: 1rem 2rem;
            border-top: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.875rem;
            color: var(--text-light);
        }

        .btn-group {
            display: flex;
            gap: 0.75rem;
        }

        .btn {
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            text-decoration: none;
            font-weight: 500;
            font-size: 0.875rem;
            transition: all 0.2s ease;
            cursor: pointer;
            border: none;
        }

        .btn-edit {
            background-color: var(--primary-color);
            color: white;
        }

        .btn-edit:hover {
            background-color: var(--primary-dark);
        }

        .notice-date {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }
        
        /* 提示样式 */
        .toast-container {
            position: fixed;
            top: 1rem;
            right: 1rem;
            z-index: 1000;
        }
        
        .toast {
            padding: 1rem;
            margin-bottom: 0.5rem;
            border-radius: 0.25rem;
            color: white;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            animation: slideIn 0.3s ease-out forwards;
        }
        
        .toast.success {
            background-color: #28a745;
        }
        
        .toast.error {
            background-color: #dc3545;
        }
        
        .toast.warning {
            background-color: #ffc107;
            color: #212529;
        }
        
        .toast.info {
            background-color: #17a2b8;
        }
        
        @keyframes slideIn {
            0% {
                transform: translateX(100%);
            }
            100% {
                transform: translateX(0);
            }
        }
        
        @keyframes slideOut {
            0% {
                transform: translateX(0);
            }
            100% {
                transform: translateX(100%);
            }
        }
    </style>
</head>
<body>
    <div id="toastContainer" class="toast-container"></div>

    <header class="header">
        <div class="logo">
            <img src="/ai-collections/static/images/logo.png" alt="Logo" class="logo-img">
            <span>AI Collections</span>
        </div>
        <nav>
            <a href="/ai-collections/">首页</a>
            <a href="/ai-collections/notice" class="active">公告</a>
        </nav>
        <div class="user-menu">
            <span class="avatar">{{if .UserInfo.IsGuest}}游客{{else}}{{.UserInfo.Username}}{{end}}</span>
        </div>
    </header>

    <div class="notice-container">
        <div class="notice-actions">
            <a href="/ai-collections/notice" class="btn-back">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                    <path fill-rule="evenodd" d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"/>
                </svg>
                返回公告列表
            </a>
            
            {{if .IsOwner}}
            <div class="btn-group">
                <a href="/ai-collections/notice/edit/{{.CurrentNotice.ID}}" class="btn btn-edit">编辑公告</a>
            </div>
            {{end}}
        </div>

        <div class="notice-detail">
            <div class="notice-header">
                <h1 class="notice-title">{{.CurrentNotice.Title}}</h1>
                <div class="notice-meta">
                    <span>作者: {{.CurrentNotice.Author}}</span>
                </div>
            </div>
            
            <div class="notice-content">
                {{.CurrentNotice.Content}}
            </div>
            
            <div class="notice-footer">
                <div class="notice-date">
                    <span>发布时间: {{.CurrentNotice.CreatedAt.Format "2006-01-02 15:04:05"}}</span>
                    {{if ne .CurrentNotice.UpdatedAt.Format "2006-01-02 15:04:05" .CurrentNotice.CreatedAt.Format "2006-01-02 15:04:05"}}
                    <span>更新时间: {{.CurrentNotice.UpdatedAt.Format "2006-01-02 15:04:05"}}</span>
                    {{end}}
                </div>
            </div>
        </div>
    </div>

    <script>
    // 显示提示函数
    function showToast(message, type = 'warning') {
        console.log('显示提示:', message, type);
        
        const container = document.getElementById('toastContainer');
        const toast = document.createElement('div');
        toast.className = `toast ${type}`;
        toast.textContent = message;
        container.appendChild(toast);

        // 3秒后自动移除
        setTimeout(() => {
            toast.style.animation = 'slideOut 0.3s ease-out forwards';
            setTimeout(() => {
                container.removeChild(toast);
            }, 300);
        }, 3000);
    }
    
    // 页面加载后设置事件监听
    document.addEventListener('DOMContentLoaded', function() {
        console.log('页面加载完成');
    });
    </script>
</body>
</html> 